fix: return only requested pages from get_page_content on Markdown#280
Open
akhilesharora wants to merge 1 commit into
Open
fix: return only requested pages from get_page_content on Markdown#280akhilesharora wants to merge 1 commit into
akhilesharora wants to merge 1 commit into
Conversation
get_page_content's docstring describes '3,8' as two discrete pages. The PDF branch honors that. The Markdown branch was treating the list as the inclusive range [min..max] and pulling in every heading between them. Match against the parsed set instead so both branches agree. Range form '5-7' still parses to [5,6,7] so range queries are unchanged; only the comma-list shape changes behavior. Closes VectifyAI#279
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_page_content's docstring says '3,8' means pages 3 and 8 (pageindex/retrieve.py:111-119). PDFs honor that. Markdown doesn't: _get_md_page_content takes min(page_nums)/max(page_nums) and returns everything in between.
Same input, before:
After:
_parse_pages already returns a discrete sorted list, so the simplest fix is to match against
set(page_nums)instead of[min..max]:Range form ('5-7') still parses to [5,6,7] so it keeps working. Only the comma-list shape changes.
Added tests/test_retrieve_pages.py with four cases. Two of them fail on main and pass with the fix. The other two cover the range and single-page forms to make sure nothing regresses there.
Files touched:
No PDF behavior change, no API surface change.
Closes #279